package com.xiaoyu.izf.model.page;

import com.xiaoyu.izf.model.exception.BusinessStatusEnum;

public class FormResult<T> {

	//应用状态码
	private int status;
	//错误描述
	private String message;

	private T data;

	public FormResult(int status, String message, T data) {
		this.status = status;
		this.message = message;
		this.data = data;
	}

	public FormResult(int status, String message) {
		this.status = status;
		this.message = message;
	}

	public FormResult(BusinessStatusEnum statusEnum){
		this.status = statusEnum.status();
		this.message = statusEnum.message();
	}
//	public FormResult(BusinessStatusEnum statusEnum,String formatAgrs){
//		this.status = statusEnum.status();
//		this.message = String.format(statusEnum.message(),formatAgrs);
//	}

	public FormResult(BusinessStatusEnum statusEnum,T data){
		this.status = statusEnum.status();
		this.message = statusEnum.message();
		this.data = data;
	}
	public FormResult(BusinessStatusEnum statusEnum,T data,String formatAgrs){
		this.status = statusEnum.status();
		this.message = String.format(statusEnum.message(),formatAgrs);
		this.data = data;
	}

	public FormResult() {
	}

	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
}
